treeview: Don't make things way too high
authorBenjamin Otte <otte@redhat.com>
Thu, 25 Feb 2016 03:02:39 +0000 (04:02 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 25 Feb 2016 03:03:41 +0000 (04:03 +0100)
If the size-request is larger than the dedicated size, don't increase
the dedicated size by the size request, only increase it to the
size request.

gtk/gtktreeview.c

index 47ea9f7cc66c84b00164e36ea6ecb9f584cb45bb..e46737d569049467269dd8e6d18a13bc3293257b 100644 (file)
@@ -2991,8 +2991,8 @@ gtk_tree_view_size_allocate (GtkWidget     *widget,
       gtk_widget_get_preferred_width (GTK_WIDGET (child->widget), &size, NULL);
       if (size > child_rect.width)
         {
-          child_rect.x -= size / 2;
-          child_rect.width += size;
+          child_rect.x -= (size - child_rect.width) / 2;
+          child_rect.width = size;
         }
 
       gtk_widget_get_preferred_height_for_width (GTK_WIDGET (child->widget),
@@ -3000,8 +3000,8 @@ gtk_tree_view_size_allocate (GtkWidget     *widget,
                                                  &size, NULL);
       if (size > child_rect.height)
         {
-          child_rect.y -= size / 2;
-          child_rect.height += size;
+          child_rect.y -= (size - child_rect.height) / 2;
+          child_rect.height = size;
         }
 
       /* push the rect back in the visible area if needed, preferring the top left corner */